cmake_minimum_required(VERSION 3.17)

get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId} C)

set(CMAKE_C_STANDARD 23)
include_directories("include src") # 将自己的需要被检索的路径，加入到工程路径中。

# 一个源文件对应一个可执行文件，无法一个可执行文件对应多个源文件
#file(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.c")
#foreach(file ${files})
#    get_filename_component(name ${file} NAME)
#    add_executable(${name} ${file})
#    message("Processing file: ${file} Extracted name: ${name}")
#endforeach()


## 手动添加（推荐），对于需要多个依赖文件的
add_executable(test src/main.c src/loop.c drv/led.c )
#message("Processing file: ${file} Extracted name: ${name}")

#add_executable(test example.c cJSON.c)         # 手动添加依赖
